import { client } from './../../api/url'
import { LAYOUT } from '@/store/keys'

export const constantRoutes = [
  {
    path: '/',
    redirect: '/login',
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login/index.vue'),
    meta: {
      hidden: true,
    },
  },
  {
    path: '/children',
    redirect: '/children/login',
  },
  {
    path: '/children/login',
    name: 'userAdminLogin',
    component: () => import('@/views/children/login/index.vue'),
    meta: {
      hidden: true,
    },
  },
  {
    path: '/redirect',
    component: LAYOUT,
    meta: {
      hidden: true,
      noShowTabbar: true,
    },
    children: [
      {
        path: '/redirect/:path(.*)*',
        component: (): any => import('@/views/redirect/index.vue'),
      },
    ],
  },
  // {
  //   path: '/personal',
  //   name: 'personal',
  //   component: LAYOUT,
  //   meta: {
  //     title: '个人中心',
  //     hidden: true,
  //   },
  //   children: [
  //     {
  //       path: '/children/personal/info',
  //       component: () => import('@/views/personal/index.vue'),
  //       meta: {
  //         title: '个人中心',
  //       },
  //     },
  //   ],
  // },
  {
    path: '/application',
    name: '操作应用',
    component: LAYOUT,
    meta: {
      title: '应用',
      hidden: true,
    },
    children: [
      {
        path: '/other/one/card',
        component: () => import('@/views/application/one/card.vue'),
        meta: {
          title: '一卡一码',
        },
      },
      {
        path: '/other/complaints',
        name: '投诉',
        component: () => import('@/views/system/feedBack.vue'),
        meta: {
          hidden: true,
        },
      },
      {
        path: '/auxiliary/notice',
        component: () => import('@/views/marketing/client/notice.vue'),
        meta: {
          title: '通知公告',
        },
      },
      {
        path: '/other/complaint',
        component: () => import('@/views/operate/complaint.vue'),
        meta: {
          title: '商户投诉',
        },
      },
      {
        path: '/marketing/coupon',
        component: () => import('@/views/marketing/coupon.vue'),
        meta: {
          title: '优惠券包',
        },
      },
      {
        path: '/marketing/speed',
        component: () => import('@/views/marketing/speed.vue'),
        meta: {
          title: '极速会员',
        },
      },
      {
        path: '/other/poll',
        component: () => import('@/views/application/share/index.vue'),
        meta: {
          title: '共享池',
        },
      },
      {
        path: '/other/live/code',
        component: () => import('@/views/application/liveCode/index.vue'),
        meta: {
          title: '活码设置',
        },
      },
      {
        path: '/other/decoration/plan',
        component: () => import('@/views/application/decorate/index.vue'),
        meta: {
          title: '装修方案',
        },
      },
    ],
  },
  {
    path: '/setting/up',
    name: '工单详情',
    component: LAYOUT,
    meta: {
      title: '工单详情',
      hidden: true,
    },
    children: [
      {
        path: '/setting/work/orderDetail',
        component: () => import('@/views/setting/work/orderDetail.vue'),
        meta: {
          title: '工单详情',
        },
      },
    ],
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/exception/404.vue'),
    meta: {
      hidden: true,
    },
  },

  {
    path: '/systemLogin',
    name: 'systemLogin',
    component: () => import('@/views/exception/admin.vue'),
    meta: {
      hidden: true,
    },
  },
  {
    path: '/500',
    name: '500',
    component: () => import('@/views/exception/500.vue'),
    meta: {
      hidden: true,
    },
  },
  {
    path: '/403',
    name: '403',
    component: () => import('@/views/exception/403.vue'),
    meta: {
      hidden: true,
    },
  },
  {
    path: '/channel/pageSet/design',
    name: 'pageSet',
    component: () => import('@/views/channel/pageSet/design.vue'),
    meta: {
      hidden: true,
    },
  },
  {
    path: '/goods',
    name: '商品',
    component: () => import('@/views/mall/goods.vue'),
    meta: {
      hidden: true,
    },
  },
  {
    path: '/oneCards',
    name: '单卡操作',
    component: () => import('@/views/card/single.vue'),
    meta: {
      hidden: true,
    },
  },
  {
    path: '/application/liveCode/design',
    name: 'pageSets',
    component: () => import('@/views/application/liveCode/design.vue'),
    meta: {
      hidden: true,
    },
  },
]

/**
 * 这个路由是为了防止vue-router在一开始匹配不到路由的时候报：
 * No match found for location with xxx 的警告
 */
export const defaultPathRoute = {
  path: window.location.hash.replace('#', '') || window.location.pathname,
  name: 'defaultRouteName',
  component: () => import('@/views/redirect/default-route.vue'),
  meta: {
    hidden: true,
    noShowTabbar: true,
  },
}
